<?php

$dbl = $PARAPARA->dblayer;

if($_GET['do'] == 'form_action') {

    $del_threads = array();
    $del_msgs    = array();

    if( is_array( $_POST['pf_thread'] ) )
        foreach( $_POST['pf_thread'] as $thread_id )
            if(is_numeric( $thread_id ) )
                array_push( $del_threads, $thread_id );

    
    $deleted_thread_count = $dbl->forum_delete_threads( $del_threads );

    $deleted_message_count = 0;
     if( is_array( $_POST['pf_msg'] ) )
         foreach( $_POST['pf_msg'] as $tag )
             if( preg_match('/^(\d+):(\d+)$/', $tag, $matches) )
                 $deleted_message_count += $dbl->forum_delete_message_and_children( $matches[1], $matches[2] );


     echo '<div class="padm_info">';
     if( ( $deleted_thread_count < 1 ) && ( $deleted_message_count < 1 ) )
         echo "Deleted nothing. Why nothing? Maybe someone else has deleted something? <br/>";
     if( $deleted_thread_count > 0 )
         echo "Deleted $deleted_thread_count messages in whole threads(s)<br/>";
     if( $deleted_message_count > 0 )
         echo "Deleted $deleted_message_count message(s)<br/>";

     echo 'Back to the <a href="?sec=forum&ssec=tview">the overview</a>';
     echo '</div>';

     return;

}


echo '<div class="padm_caption">Forum Administration</div>', "\n";
$forum = $PARAPARA->get_forum( '*' );
$forum->adm_htmlize( null );


?>


